package com.wangyg.juc.ProducerConsumer.version3;

import java.lang.reflect.Array;

/**
 * Created by wangyg6 on 2018/7/20.
 */
public class Psvm {
	public static void main(String[] args) {
		//		int i=7>> 1;
		//		System.out.println(i);
		String[] objects = new String[6];
		Class<? extends Object[]> newType = objects.getClass();
		System.out.println(newType.getName());
		System.out.println(newType.getComponentType().getName());
		String[] array = getArray(objects.getClass());
	}

	public static <T> T[] getArray(Class<? extends T[]> type) {
		T[] copy = ((Object) type == (Object) Object[].class)
				? (T[]) new Object[128]
				: (T[]) Array.newInstance(type.getClass().getComponentType(), 128);
		return copy;
	}
}
